package com.lty;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author lty
 */
@Configuration
@ConfigurationProperties("lty.email-setting")
@Data
@ComponentScan
public class EmailSettingConfig {

    /**
     * 邮箱服务器
     */
    private String host;

    /**
     * 发送者邮箱账号
     */
    private String username;

    /**
     * 邮箱授权码
     */
    private String password;

    /**
     * 是否改变secrectKey
     */
    private Boolean changed;

    /**
     * Bean注入，引入SDK后能使用该对象
     * @return
     */
    @Bean
    public EmailSetting getEmailSetting() {
        return new EmailSetting(host, username, password, changed);
    }
}
